import 'react-hot-loader'
import React, { PureComponent } from 'react';
import dva from 'dva';
import { createBrowserHistory } from 'history';
import Router from './routes/index';
import '@/styles/index.scss';

import IndexModel from './pages/index/model';

const hashHistory = createBrowserHistory({ basename: '' });

const app = dva({
  history: hashHistory,
  onError() {
    console.log('catch err');
  }, // 不能缺少，不然错误时会抛出异常
});

app.model(IndexModel);

app.router((r: any) => <Router history={r.history} />);

app.start('#root');

const hot = (module as any).hot;

hot && hot.accept();
